package com.example.myapplication.pages;

import android.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import androidx.annotation.Nullable;

import com.example.myapplication.view_type.ListAdapter;
import com.example.myapplication.bean.Person;
import com.example.myapplication.dao.MySQLiteOpenHelper;
import com.example.myapplication.databinding.ActivityPage4Binding;
import com.example.myapplication.service.SharedPreferencesService;

import java.util.List;

/**
 * 4：分类查询同事界面
 */
public class page_4 extends Fragment {
    private ActivityPage4Binding page4Binding;
    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) {
        page4Binding = ActivityPage4Binding.inflate(inflater,container,false);
        Integer userId = (Integer) SharedPreferencesService.getUserInfo(getContext()).get("userId");
        List<Person> personList = new MySQLiteOpenHelper(getContext()).queryPersonByCondition(5,null,4, userId);

        page4Binding = ActivityPage4Binding.inflate(getLayoutInflater());

        ListAdapter listAdapter = new ListAdapter(personList, getContext());
        page4Binding.relation4.setAdapter(listAdapter);
        return page4Binding.getRoot();
    }
}